package com.immunology.service;

import java.util.List;
import java.util.Map;

import com.immunology.dao.ComplaintDao;
import com.immunology.database.transformers.ComplaintTransformer;
import com.immunology.model.Complaint;

public class ComplaintService {

	private static ComplaintService complaintService = null;
	private ComplaintDao complaintDao = new ComplaintDao(
			new ComplaintTransformer());

	private ComplaintService() {
	}

	public static ComplaintService getInstance() {
		if (complaintService == null) {
			complaintService = new ComplaintService();
		}
		return complaintService;
	}

	public void insert(String complaintName, int typeId) {
		Complaint complaint = new Complaint();
		complaint.setName(complaintName);
		complaint.setTypeId(typeId);
		complaintDao.insert(complaint);
	}

	public void delete(int complaintId) {
		complaintDao.delete(complaintId);
	}
	public void update(int complaintId, Complaint complaint) {
		complaintDao.update(complaintId,complaint);
	}

	public Map<String, Map<String, List<Complaint>>> getComplaintList() {
		return complaintDao.getComplaintList();
	}

	public Map<String, Map<String, List<Complaint>>> getComplaintListBySyndromeId(
			int syndromeId) {
		return complaintDao.getComplaintListBySyndromeId(syndromeId);
	}

	public int getComplaintTypeIdByComplaintId(int complaintId) {
		return complaintDao.getComplaintTypeIdByComplaintId(complaintId);
	}
	public Complaint getComplaintById(int complaintId) {
		return complaintDao.getById(complaintId);
		
	}

}
